package com.cet.designpatterns.flyweight;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-09-14 14:29
 **/
public class Client {
    public static void main(String[] args) {
        WebsiteFactory websiteFactory = new WebsiteFactory();

        Website newsWebsite = websiteFactory.getWebsiteByCategory("news");
        newsWebsite.use(new User().setName("Tom"));

        Website blogWebsite1 = websiteFactory.getWebsiteByCategory("blog");
        blogWebsite1.use(new User().setName("Jack"));

        Website blogWebsite2 = websiteFactory.getWebsiteByCategory("blog");
        blogWebsite2.use(new User().setName("Jerry"));

        Website blogWebsite3 = websiteFactory.getWebsiteByCategory("blog");
        blogWebsite3.use(new User().setName("Rose"));

        System.out.println("网站类型总数为:" + websiteFactory.getWebsiteCount());
    }
}
